var twoSum = function (nums, target) {
    
    var result = [],
        len = nums.length;
    for (var i = 0; i < len; i++) {
        // 注意，这里从i+1开始遍历
        for (var j = i + 1; j < len; j++) {
            if (nums[i] + nums[j] === target) {
                // 注意，concat返回一个新数组
                result = result.concat(i, j);
                return result;
            };
        };
    }
};
nums = [2,7,11,15], target = 9

twoSum(nums,target)